import Vue from 'vue';
import VueRouter, { router } from './config/routers';
import Vuex, { store } from './config/store';
import axios from 'config/axios';
import VueAxios from 'vue-axios';
import app from 'modules/app.vue';
import { registerGlobalComponents } from './config/iview';
import VueI18n from 'vue-i18n';
import awaitMessages, { locale } from 'config/i18n';
//不修改源码的情况下，替换iview原有的校验框架
import 'config/validator';

import 'view-design/dist/styles/iview.css';
import './css/main-style.css';
import 'animate.css/animate.compat.css';

Vue.use(Vuex);
Vue.use(VueRouter);
Vue.use(VueI18n);
Vue.use(VueAxios, axios);

registerGlobalComponents(Vue);

//国际化加载
awaitMessages().then((messages) => {
    const i18n = new VueI18n({
        locale, // set locale
        messages // set locale messages
    });

    new Vue({
        el: "#app",
        i18n,
        router,
        store: new Vuex.Store(store),
        render: h => h(app)
    });
});